home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swaga_c.zip / COLOR.SWG / 0009_Hi Inetnsity Colors #3.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  2KB  |  76 lines

  1. {
  2. I have seen a lot of applications that use highintensity background
  3. colors in Text mode.  How do they do it??????
  4. }
  5.  
  6. Program HighInt; {  91-5-30  Robert Mashlan
  7.    Public Domain
  8.  
  9.    The following Program is an example of how to set the CrtC controller
  10.    in in order that high intensity backgrounds may be displayed instead
  11.    of blinking Characters, or use the the EGA/VGA BIOS to do the same
  12.    thing.
  13. }
  14.  
  15. Uses
  16.    Dos, Crt;
  17.  
  18. Const
  19.    HighIntesity = Blink;  (* high intesity attribute mask *)
  20.  
  21.  
  22. Procedure HighIntensity( state : Boolean );
  23. (* enables or disables high intensity background colors *)
  24.  
  25. Const
  26.    BlinkBit   = $20;  (* For mode select port, bit 5 *)
  27.    ModeSelofs = 4;    (* offset from CrtC port base *)
  28.  
  29. Var
  30.    R : Registers;
  31.    (* BIOS data area Variables *)
  32.    CrtMode     : Byte Absolute $0040:$0065; (* current CrtC mode *)
  33.    CrtPortBase : Word Absolute $0040:$0063; (* CrtC port base addr *)
  34.  
  35.    Function EgaBios : Boolean;
  36.    { test For the existance of EGA/VGA BIOS }
  37.    Var R : Registers;
  38.    begin
  39.       With R do begin
  40.          AH := $12;
  41.          BX := $ff10;
  42.          Intr($10,R);
  43.          EgaBios := BX <> $ff10;
  44.       end;
  45.    end;
  46.  
  47. begin
  48.    if EgaBios then With R do begin  (* use EGA/VGA BIOS Function *)
  49.       R.AX := $1003;
  50.       if state then BL := 0
  51.                else BL := 1;
  52.       Intr($10,R);
  53.    end else begin  (* Program CGA/MDA/Herc CrtC controller *)
  54.       if state then  CrtMode := CrtMode and not BlinkBit
  55.                else  CrtMode := CrtMode or BlinkBit;
  56.       Port[ CrtPortBase + ModeSelofs ] := CrtMode;
  57.    end;
  58. end;
  59.  
  60.  
  61. begin
  62.    HighIntensity(True);
  63.    if LastMode = 7 then
  64.       TextAttr := $80 + $7E
  65.     else
  66.       Textattr := $80 + $6D;
  67.    ClrScr;
  68.    TextBackGround(green);
  69.    GotoXY(20,11);
  70.    Writeln('What do you think of this background?');
  71.    GotoXY(1,25);
  72.    Repeat Until ReadKey <> #0;
  73.    HighIntensity(False);
  74.    ClrScr;
  75. end.
  76.